package com.blue.waffle.iwc.domains;

import java.io.File;
import java.io.FileNotFoundException;

import java.sql.SQLException;

import com.badlogic.gdx.scenes.scene2d.ui.List;
import com.blue.waffle.iwc.domains.Word;
import com.blue.waffle.iwc.domains.helpers.CSVHelper;
import com.blue.waffle.iwc.domains.helpers.WordHelper;




public class CSVReaderMain {

	/**
	 * @param args
	 * @throws FileNotFoundException
	 * This is the Main class that Inserts Data from file to the Database 
	 */
	
	
	
		public CSVReaderMain(File file, WordHelper sqlite) throws FileNotFoundException 
		{		 
			
			String[][] Word = CSVHelper.getFileData(file);		
			
			
		 for(int i=0; i<Word.length;i++)
		 {
			System.out.println("Word at:(" + i + ",0):" + Word[i][0]);
			System.out.println("Word at:(" + i + ",1):" + Word[i][1]);
			try {
				
				sqlite.insert(new Word(0, Word[i][0],Word[i][1]));
				sqlite.selectAll();
			} catch (SQLException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		 }
		 		 
	}

}